export class ServiceManager {
    static Current: ServiceManager = new ServiceManager();
    private svrList: IManagerServiceListItem[] = [];

    RegistService(serviceList: IManagerServiceListItem[]) {
        for (let svr of serviceList) {
            let item = this.svrList.find(x => x.serviceName.toLocaleLowerCase() === svr.serviceName.toLocaleLowerCase());
            if (item) return;
            this.svrList.push(svr);
        }
    }
    GetService<T>(serviceName: string): T {
        let item = this.svrList.find(x => x.serviceName.toLocaleLowerCase() === serviceName.toLocaleLowerCase());
        if (item)
            return item.service;
        else return null;
    }
}

interface IManagerServiceListItem {
    service: any;
    serviceName: string;
}